package com.wj.converter;

import com.wj.constant.BrandCategory;
import com.wj.constant.GoodsStatus;

import javax.persistence.AttributeConverter;

/**
 * 品牌分类枚举属性转换性
 */
public class BrandCategoryConverter implements AttributeConverter<BrandCategory,String> {


    @Override
    public String convertToDatabaseColumn(BrandCategory brandCategory) {
        return brandCategory.getCode();
    }

    @Override
    public BrandCategory convertToEntityAttribute(String code) {
        return BrandCategory.of(code);
    }
}
